import {
  http,
  assignData
} from '../utils/request'
import store from '@/store/index'
const aid = store.state.user.defaultParams.aid

// 获取短剧列表
export const getApiVideoList = (pn, ps, video_id) =>
  http.get(`/Video/getVideoList`, assignData({
    pn,
    ps,
    video_id
  }))

/**
 * 获取观看历史记录
 * @param {*} eid
 * @returns
 */
export const getApiHistoryList = (eid) =>
  http.get(`/User/getUserHistory`, assignData({
    eid
  }))

/**
 * 获取当前短剧的剧集
 * @param {*} video_id
 * @param {*} eid
 * @returns
 */
export const getApiEpisodeList = (video_id, pn, ps, eid) =>
  http.get(`/Episode/getEpisodeList`, assignData({
    eid,
    video_id,
    pn,
    ps
  }))

export const dyGetEpisodeList = (params) =>{
  const { video_id, pn, ps, eid } = params;
  return http.get(`/Episode/dyGetEpisodeList`, assignData({
    eid,
    video_id,
    pn,
    ps
  }))
}


/**
 * 获取剧集详情
 * @returns
 */
export const getApiEpisodeInfo = (video_id, sort, eid) =>
  http.get(
    `/Episode/getEpisodeInfo`,
    assignData({
      video_id,
      sort,
      eid,
    })
  )

/**
 * 获取剧集详情
 * @returns
 */
export const getDyAdEpisodeInfo = (video_id, sort, eid) =>
  http.get(
    `/Episode/getDyAdEpisodeInfo`,
    assignData({
      video_id,
      sort,
      eid,
    })
  )

/**获取首页轮播图列表 */
export const getApiSwiperList = (aid) =>
  http.get(
    `/Banner/getBanner`,
    assignData({
      aid,
    })
  )

/**获取追剧列表 */
export const getApiUserCollectList = (eid, pn, ps) =>
  http.get(`/User/getUserCollect`, assignData({
    eid,
    pn,
    ps
  }))

/**
 *设置追剧
 * @returns
 */
export const saveApiUserCollect = (video_id, eid) =>
  http.post(
    `/User/saveUserCollect`,
    assignData({
      video_id,
      eid,
    })
  )

/**取消追剧 */
export const delApiUserCollect = (video_id, eid) =>
  http.post(
    `/User/delUserCollect`,
    assignData({
      video_id,
      eid,
    })
  )

/**首页模块短剧列表数据 */
export const getApiVideoTypeList = (eid, type) => http.get('/Video/getVideoTypeList', assignData({
  eid,
  type,
}))



export const getPayDescribe = ({
  eid
}) => http.get('/PayTemplate/payDescribe', assignData({
  eid,
}))
export const getUserAgreement = () => http.get('/PayTemplate/userAgreement')



export const getBannerRecommend1 = () =>
  http.post(
    `/Banner/getRecommend`,
    assignData({
      type: 1
    })
  )


export const getBannerRecommend2 = () =>
  http.post(
    `/Banner/getRecommend`,
    assignData({
      type: 2
    })
  )

export const getBannerRecommend3 = () =>
  http.post(
    `/Banner/getRecommend`,
    assignData({
      type: 3
    })
  )


export const getBannerRecommend4 = () =>
  http.post(
    `/Banner/getRecommend`,
    assignData({
      type: 4
    })
  )

export function RewardedVideoAdShow (params) {
  const { channel_id, plan_id, eid } = params;
  return http.get('/AdUse/RewardedVideoAdShow', assignData({
    channel_id, plan_id, eid
  }))
}

export function RewardedVideoAdEnd (params) {
  const { channel_id, plan_id, eid } = params;
  return http.get('/AdUse/RewardedVideoAdEnd', assignData({
    channel_id, plan_id, eid
  }))
}

export function RewardedVideoAdNoEnd (params) {
  const { channel_id, plan_id, eid } = params;
  return http.get('/AdUse/RewardedVideoAdNoEnd', assignData({
    channel_id, plan_id, eid
  }))
}

export function dyUnlockEpisode (params) {
  const { video_id, sort, eid, channel_id, plan_id, encrypted } = params;
  return http.get('/Episode/dyUnlockEpisode', assignData({
    video_id, sort, eid, channel_id, plan_id, encrypted
  }))
}

export function BannerIndexRecommend (params) {
  return http.get('/Banner/indexRecommend', assignData({
    
  }))
}
